package cn.ty.comm.dict.controller;

import cn.ty.comm.dict.dao.SysBizDictDao1;
import cn.ty.comm.dict.entity.SysBizDict;
import cn.ty.comm.dict.service.BizDictService;
import lombok.RequiredArgsConstructor;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author summit
 * @since 2021/7/4 12:30
 */
@RestController
@RequestMapping("/zuji")
@RequiredArgsConstructor
public class SysBizDictController {

	private final BizDictService bizDictService;

	private final SysBizDictDao1 sysBizDictDao1;


	@GetMapping("/spec")
	public void spec() {
		bizDictService.conditionSelect();
	}

	@GetMapping("/spec1")
	public void spec1() {
		bizDictService.objectQuery();
	}

	@PostMapping("/save")
	public void save(@RequestBody SysBizDict dict) {
		sysBizDictDao1.save(dict);
	}


	@GetMapping("/batchSave")
	public void batchSave() {
		long start = System.currentTimeMillis();
		bizDictService.batchSave();
		long end = System.currentTimeMillis();
		System.out.println("总耗时：" + (end - start) / 1000);

	}

	@GetMapping("/batchSave1")
	public void batchSave1() {
		long start = System.currentTimeMillis();
		bizDictService.batchSave1();
		long end = System.currentTimeMillis();
		System.out.println("总耗时：" + (end - start) / 1000);
	}
}
